/**
 * 
 */
package ca.uwindsor.cs.deepweb.estimation.experiment.wikipedia.chinese;

import java.io.IOException;

import ca.uwindsor.cs.deepweb.estimation.DataCollectorWithLimitationRandom;
import ca.uwindsor.cs.deepweb.estimation.FilesContentIndexer;

/**
 * @author Liang Jie
 * 
 */
public class ZHCharacterQueryRunnerWithLimit extends ZHCharacterQueryRunner {

	protected int limit;

	public ZHCharacterQueryRunnerWithLimit(String indexdir, int corpussize, String dictfile,
			String length, String result, String limitation) throws IOException {
		super(indexdir, corpussize, dictfile, length, result);
		limit = Integer.parseInt(limitation);
		super.datacollector = new DataCollectorWithLimitationRandom(
				FilesContentIndexer.FIELD_ID, limit);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
//		 args = new String[6];
//		 args[0] = "Experiment\\zh_wiki";
//		 args[1] = "Dictionary\\ChineseWords.txt";
//		 args[2] = "0";
//		 args[3] = "Result";
//		 args[4] = "10";
//		 args[5] = "5";

		if (args.length != 7) {
			System.out
					.println("usage: java -jar ZHCharacterQueryRunnerWithLimit.jar LuceneIndexDirectory DictionaryFile minWordLength[ignored] ResultDirectory StepNumber  limit_on_returned");
		} else {
			try {
				ZHCharacterQueryRunnerWithLimit query = new ZHCharacterQueryRunnerWithLimit(
					args[0], Integer.parseInt(args[1]), args[2], args[3], args[5],args[6]);
			int step = Integer.parseInt(args[4]);
			
				query.goQuery(step);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

}
